<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('表单记录')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li class="select-time">
                                <p>填写日期：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginRecordDate]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endRecordDate]"/>
                            </li>
                            <li>
                                <p>表单名称：</p>
                                <input type="text" name="layoutName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>


            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('form:record:edit')}]];
        var removeFlag = [[${@permission.hasPermi('form:record:remove')}]];
        var prefix = ctx + "form/record";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "表单记录",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'recordId', 
                    title : 'recordId',
                    visible: false
                },
                {
                    field : 'adm',
                    title : '就诊id',
                    visible: false
                },
                {
                    field : 'recordVersionId',
                    title : '版本id',
                    visible: false
                },
                {
                    field : 'recordUserName',
                    title : '表单填写人'
                },
                {
                    field : 'layoutName',
                    title : '表单名称'
                },
                {
                    field : 'recordDate', 
                    title : '填写日期'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="editForm(\'' + row.recordId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.recordId + '\')"><i class="fa fa-remove"></i>删除</a>');

                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function editForm(recordId){
            var url=ctx + "form/display/preview/"+recordId+"/0/0";
            $.modal.openTab("预览表单/"+recordId, url);
        }
    </script>
</body>
</html>